package com.cdl.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cdl.dao.BasicMapper;
import com.cdl.entity.User;
import com.cdl.service.BasicService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Service("basicServiceImpl")
public abstract class BasicServiceImpl<T> implements BasicService<T>{
	
	private static final Integer PAGE_NUM = 1 ;
	private static final Integer PAGE_SIZE = 10 ;
	
	public PageInfo<T> getPage(Integer pageNum,Integer pageSize,T condition){
		int num = (pageNum==null?PAGE_NUM:pageNum);
		int size = (pageSize==null?PAGE_SIZE:pageSize);
		PageHelper.startPage(num, size);
		List<T> list = getList(condition);
		return new PageInfo<T>(list);
	}

	
}
